<?php

use Illuminate\Database\Schema\Blueprint;

class CreateSystemGroups extends \App\Utils\CreateMigration
{
    function columns(Blueprint $table)
    {
        $table->string('name', 50)->comment('分组名称');
        $table->string('code', 50)->comment('分组编码');
        $table->string('desc')->nullable()->comment('备注');
        $table->unique(['code', 'deleted_at'], 'uk_code');
    }

    function tableInfo()
    {
        return ['system__groups', '系统-分组表'];
    }

    function getData()
    {
        $date = date('Y-m-d H:i:s');
        return [
            [
                'name' => '平台组',
                'code' => \App\Models\System\Group::PLAT,
                'desc' => '管理全平台所有内容',
                'created_at' => $date,
                'updated_at' => $date
            ],
            [
                'name' => '医院',
                'code' => \App\Models\System\Group::HOSPITAL,
                'desc' => '医院管理员',
                'created_at' => $date,
                'updated_at' => $date
            ],
            [
                'name' => '话务员',
                'code' => \App\Models\System\Group::CALLER,
                'desc' => '话务员信息',
                'created_at' => $date,
                'updated_at' => $date
            ],
            [
                'name' => '客服',
                'code' => \App\Models\System\Group::CUSTOM_SERVICE,
                'desc' => '客服信息',
                'created_at' => $date,
                'updated_at' => $date
            ],
            [
                'name' => '导医',
                'code' => \App\Models\System\Group::GUIDE,
                'desc' => '据说导医不控制权限',
                'created_at' => $date,
                'updated_at' => $date
            ]
        ];
    }
}